<template>
  <div class="search_route">
    {{search_route}}
    <el-form :model="search_route"
             ref="search_route"
             :inline="true"
             size="small">
      <el-form-item prop="route_keyword">
        <el-input v-model.trim="search_route.route_keyword"
                  clearable
                  @change="handleSearchChange"
                  placeholder="请输入关键字"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button class="el-btn-success">查询</el-button>
        <el-button plain
                   @click="resetForm('search_route')">重置</el-button>
      </el-form-item>
      <el-form-item>
        <el-button type="primary"
                   plain
                   size="small"
                   style="margin-left:30px"
                   class="el-btn-success"
                   @click="addRoutes">添加路由</el-button>
      </el-form-item>
    </el-form>

  </div>
</template>

<script>
export default {
  data () {
    return {
      search_route: {
        route_keyword: ''
      },
    }
  },
  methods: {
    handleSearchChange () {
      this.$parent.handleSearchChange(this.search_route)
    },
    resetForm (formName) {
      this.$refs[formName].resetFields();
    },
    addRoutes () {
      this.$parent.addRoutes()
    }
  }
}
</script>